//
//  RHAboutOneUpgradeController.m
//  RuiHeAppApp
//
//  Created by Jun on 2023/8/4.
//

#import "RHAboutOneUpgradeController.h"
#import "QMUILabel+LHAdd.h"

@interface RHAboutOneUpgradeController ()

@end

@implementation RHAboutOneUpgradeController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = CFTabViewBgColor;
    [self.navigationItem setTitle:@"固件详情".rh_localized];
    [self setupUI];
}


- (void)setupUI{
    
    UIButton *okButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0,40, 64)];
    [okButton setBackgroundColor:UIColor.clearColor];
    [okButton setTitleColor:CFMainColor forState:UIControlStateNormal];
    [okButton.titleLabel setFont:[UIFont systemFontOfSize:15]];
    [okButton setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight];
    [okButton setTitle:@"关闭".rh_localized forState:UIControlStateNormal];
    [okButton addTarget:self action:@selector(didClickAdd) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *rightBarBtn = [[UIBarButtonItem alloc] initWithCustomView:okButton];
    self.navigationItem.rightBarButtonItem = rightBarBtn;
    
    
    QMUILabel *titleLab = [[QMUILabel alloc] init];
    [titleLab setText:@"此固件包含以下增加功能和bug修复:".rh_localized];
    [titleLab setTextColor:kCOLOR_HEX(@"3F4443")];
    [titleLab setFont:[UIFont boldSystemFontOfSize:16]];
    [titleLab setTextAlignment:NSTextAlignmentLeft];
    [titleLab setNumberOfLines:2];
    [self.view addSubview:titleLab];
    
    
    QMUILabel *contentLab = [[QMUILabel alloc] init];
    [contentLab setTextColor:[kCOLOR_HEX(@"3F4443") colorWithAlphaComponent:0.8]];
    [contentLab setFont:[UIFont systemFontOfSize:13]];
    [contentLab setTextAlignment:NSTextAlignmentLeft];
    [contentLab setNumberOfLines:0];
    [self.view addSubview:contentLab];
    
    
    
    [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.right.mas_offset(-15);
        make.top.mas_offset(10);
        make.height.mas_equalTo(40);
    }];
    
    [contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(titleLab);
        make.top.equalTo(titleLab.mas_bottom).offset(5);
        make.height.mas_equalTo(30);
    }];
    
   
    [contentLab setText:_firmwareModel.describe_lan];
    
    
    
    CGSize size = [contentLab getLableSizeWithMaxWidth:SCREEN_WIDTH-30];
    [contentLab mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(size.height);
    }];
}

- (void)didClickAdd{
    [self.navigationController dismissViewControllerAnimated:YES completion:nil];
}

@end
